#include<iostream>
using namespace std;
class Date 
{
private:
	int year,month,day;
public:
	Date(int year=1990,int month=1,int day=1);
	Date(const Date &r);
	void Print();
};
Date::Date(int year,int month,int day) 
{
	this->year=year;
	this->month=month;
	this->day=day;
}
Date::Date(const Date &r) 
{
	year=r.year;
	month=r.month;
	day=r.day;
}
void Date::Print() 
{
	cout<<year<<"-"<<month<<"-"<<day<<endl;
}
class Person 
{
private:
	char name[20];
	char gender;
	Date birthday;
	static int count;
public:
	Person() : name(""), gender(' '), birthday(1990, 1, 1) {} 
	Person(const char* name, char gender, const Date& date) : birthday(date)
	{
		strncpy(this->name,name,sizeof(this->name)-1);
		this->name[sizeof(this->name)-1]='\0';
		this->gender=gender;
		count++;
	}	
	~Person(){}
	void Test1();
	int GetCashFlow();
	void Print();
};
int Person::count = 0;
void Person::Test1()
{
    Person p1,p2("zhang",'f',Date(1991,1,1)),p3(p2);
    p3.Print();//输出: “姓名:zhang;性别: 女;生日:1991-1-1;
    cout<<"收支为："<<p3.GetCashFlow()<<"元"<<endl; //输出：0元
    Person *p=new Person("li",'m',Date(1990,2,2));//创建堆对象（调用有参构造）
    p->Print();//输出堆对象基本信息
    delete p;//释放堆对象
}
int Person::GetCashFlow()
{
	return 0;
}
void Person::Print() 
{
    cout << "姓名:" << name << ";性别:" << (gender == 'f' ? "女" : "男") << ";生日:";
    birthday.Print(); // 单独调用
}
int main() 
{
	Person p;
	p.Test1();
	return 0;
}